#script for gmail account
#purposse: Login and verify all functionalities of gmail.com email client
#
#
#       Steps:
#               1. Define all necessary selenium dependencies
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.selenium import selenium

x = "rtests2013"
y = "rtest2013"

def AccountLogin(a, b):
        driver1 = webdriver.Firefox()
        driver1.get("http://gmail.com")

        #finding two elements on page login=Email, password=Passwd
        login = driver1.find_element_by_id('Email')
        password = driver1.find_element_by_name('Passwd')

        #sending an value to founded elements
        login.send_keys(x)
        password.send_keys(y)

        #search and press Enter button
        enter1 = driver1.find_element_by_name('signIn')
        enter1.send_keys(Keys.ENTER)
        
        #find SignOut option
        #signout1 = driver1.find_element_by_id('gbgs4dn')
        
        #signout1 = driver1.find_elements_by_xpath("//span[@id='gbgs4dn']")
        signout1 = driver1.find_element_by_class_name("gbgt gbg4p gbes")
        signout1.send_keys(Keys.RETURN)
    
AccountLogin(x, y)
        
        
        
        



#login:    rtests2013
#pass:      rtest2013